﻿@using ClinicaMVC3.Controllers
@model IEnumerable<ClinicaMVC3.Models.Funcionario>
@{
    
}
<h2>
    Listagem de @ViewBag.Title
</h2>
<p>
</p>
<div >
    @Html.ActionLink("Novo", "Create")
</div>
@if (Model.Count() == 0)
{
    <span>Não há registros para listar.</span>
}
else
{


    <table class="tbl display">
        <thead>
            <tr>
                <th>
                    @foreach (var item in Model)
                    {
                        @Html.LabelFor(model => item.Nome)
                        break;
                    }
                </th>
                <th>
                    @foreach (var item in Model)
                    {
                        @Html.LabelFor(model => item.RG)
                        break;
                    }
                </th>
                <th>
                    @foreach (var item in Model)
                    {
                        @Html.LabelFor(model => item.endereco)
                        break;
                    }
                </th>
                <th>
                    @foreach (var item in Model)
                    {
                        @Html.LabelFor(model => item.funcao)
                        break;
                    }
                </th>
                <th>
                </th>
            </tr>
        </thead>
        <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Nome)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.RG)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.endereco)
                </td>
                <td>
                    @MvcHtmlString.Create(FuncionarioController.getFuncaoText(item.funcao))
                </td>
                <td>
                    @Html.ActionLink("Editar", "Edit", new { id = item.FuncionarioId })
                    @Html.ActionLink("Visualizar", "Details", new { id = item.FuncionarioId })
                    @Html.ActionLink("Excluir", "Delete", new { id = item.FuncionarioId })
                </td>
            </tr>
        }
        </tbody>
    </table>
}
